<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="" />
        <meta name="format-detection" content="telephone=no">
        <title>收货地址</title>
        <link rel="stylesheet" href="../css/address1.css">
        <link rel="stylesheet" href="../css/address1/address1.css">
		<%@ include file="../general.jsp"%>
    </head>
    <body ontouchstart>
        <section class="ui-container">
            <ul class="add_con">
              <li>
                <span>收货人</span>
                <input type="text" placeholder="请添加收货人" class="input1" id="userName" value="${item.userName }">
              </li>
              <li>
                <span>联系电话</span>
                <input type="text" placeholder="请添加联系电话" class="input1" id="phone" value="${item.phone }">
              </li>
              <li class="text">
                <span>详细地址</span>                
                <textarea cols="5" placeholder="请添加详细地址" class="input1" id="address" >${item.address }</textarea>
              </li>
              <input type="hidden" id="id" value="${item.id}"/>
              <input type="hidden" id="status" value="${item.status}"/>
              <input type="hidden" id="delFlag" value="${item.delFlag}"/>
            </ul>
            <div class="add_con_bc"><a href="javascript:addaddress();">保存</a></div>
        	<div class="return_btn">
				<a href="#">
					<div class="return_btn_in">
						<img src="../images/weip.png" alt="">  
						<p>（返回微交易）</p>
					</div>
				</a>
			</div>
        </section><!-- /.ui-container-->
    </body>
</html>
<script>
function addaddress(){
	$.ajax({
		type : 'POST',
		url : "addAddress.do",
		async : 'true',
		data: {
			"id":$("#id").val(),
			"userName":$("#userName").val(),
			"phone":$("#phone").val(),
			"address":$("#address").val()
		},
		dataType : 'json',
		success : function(data){
			var result=data.result;
			if(result==1){//保存成功
				alert("保存成功");
				window.location.href="address.do";
			}else if(result==0)//保存失败
				alert("保存失败");
			
			getAddress(1);
		}
	});
}
</script>